﻿using BingVis.WPFClient;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using BingVis.Common;
using Moq;
using InfoStrat.VE;

namespace BingVis.WPFClient.Test
{
    
    
    /// <summary>
    ///This is a test class for TransitStopViewModelTest and is intended
    ///to contain all TransitStopViewModelTest Unit Tests
    ///</summary>
    [TestClass()]
    public class TransitStopViewModelTest
    {
        ITransitStop fakeStop1;

        public TransitStopViewModelTest()
        {
            var fake = new Mock<ITransitStop>();
            fake.SetupAllProperties();
            fake.SetupGet(x => x.Id).Returns("1");
            fake.SetupGet(x => x.Name).Returns("Fake Stop");
            fake.SetupGet(x => x.Latitude).Returns(42.1111);
            fake.SetupGet(x => x.Longitude).Returns(-71.1111);

            fakeStop1 = fake.Object;     
        }
        


        /// <summary>
        ///A test for Selected
        ///</summary>
        [TestMethod()]        
        public void Should_Jump_To_Stop_Lat_Long_When_Stop_Selected()
        {
            MainShellViewModel shell = new MainShellViewModel();
            var initialPoint = shell.CurrLatLong;

            shell.StopsList.AddStop.Execute(fakeStop1);

            shell.StopsList.Stops[0].Selected.Execute(null);

            Assert.AreNotEqual<double>(initialPoint.Latitude, shell.CurrLatLong.Latitude);
            Assert.AreNotEqual<double>(initialPoint.Longitude, shell.CurrLatLong.Longitude);
            Assert.AreEqual<double>(shell.CurrLatLong.Latitude, fakeStop1.Latitude);
            Assert.AreEqual<double>(shell.CurrLatLong.Longitude, fakeStop1.Longitude);
        }

        /// <summary>
        ///A test for TransitStopViewModel Constructor
        ///</summary>
        [TestMethod()]
        public void Should_Load_Members_Correctly()
        {
            ITransitStop stop = fakeStop1;
            TransitStopViewModel target = new TransitStopViewModel(stop);

            Assert.AreEqual<ITransitStop>(stop, target.Stop);
            Assert.IsNotNull(target.Selected);
        }
    }
}
